<?php
session_start();
if(!@$_SESSION['username']) {
  echo "<script>window.location.href='login.php';</script>";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>change password</title>
</head>
<body>


<?php
include_once('../../libraries/esaydb.class.php');
if($_POST) {
	$db = new EasyDB();

	$set = array(
		'username'=>$_POST['user-name'],
		'email'=>$_POST['user-email'],
		'tel'=>$_POST['user-tel'],
		'idcard'=>$_POST['user-idcard'],
	);
	$where = array('uid'=>$_SESSION['uid']);
	$result  = $db->update('ob_user',$set,$where);
	if($result) {
		echo "<script>alert('修改成功');window.location.href='../../user-password-edit.php';</script>";
	}else{
		echo "<script>alert('修改失败');history.go(-1);</script>";
	}
}else{
	echo "<script>alert('参数错误');history.go(-1);</script>";
}
?>
</body>
</html>
